There are a number of situations where it is desirable to perform multiple write transactions to different locations within a non-volatile data storage device atomically. For example, this may be due to the data files being written being too large to fit in one location, or due to an operation requiring updates in multiple locations. An example of this latter scenario is when a new file is created in a folder. The file needs to be written to the appropriate location in the non-volatile storage device, but in addition the metadata describing the folder structure in which the file is located also needs to be updated. Completion of one of these steps without the other (for instance due to a system crash) would either result in the file system indicating that there is a file which is not in fact there, or alternatively a file will exist within the storage device which is taking up space, but which is not available for access due to it not being referred to by the file system.
By arranging for a plurality of write transactions to occur atomically, this will ensure that all of those plurality of write transactions are completed, or none are completed, hence avoiding the possibility of the non-volatile data storage device ending up in an undefined state due to only a subset of the transactions having been performed.
Typically a series of write transactions would be initiated by a host device, for example a CPU, and the host device will then communicate with the non-volatile data storage device via a device controller associated with the data storage device in order to cause the transactions to be performed. When dealing with the above described write atomicity issue, in known prior art techniques it is typically the case that the host system takes responsibility for ensuring that the write transactions are performed atomically, resulting in an overhead to the software system and/or the file system of the host device.
In particular, one known approach is to employ journaling techniques whereby the host device generates some journal data for storing on the non-volatile storage device prior to the actual transactions being performed, such that if a failure occurs inconsistent data can be discovered and restored to a consistent state. Such journaling techniques lead to extra transactions being generated, with associated extra write actions being performed within the storage device. In the worst case of journaling (from a performance point of view, but the best kind from a reliability point of view), the actual data is sent twice to ensure correctness. However, such an approach negatively affects both performance and power. The known journaling mechanisms are typically independent of the underlying technology of the non-volatile data storage device, and typically form part of the file system of the host device.
It would be desirable to provide an improved mechanism for performing a plurality of write transactions atomically within a non-volatile data storage device, without requiring the use of host-side implemented safety mechanisms.